package com.zzx.test.future;

import org.junit.Test;

import java.util.List;

/**
 * @ClassName: TestClass1
 * @Description: JDK10&JDK11测试类
 * @Author ZhouZhiXin
 * @Date 2022/7/11
 * @Version 1.0
 */
public class TenAndElevenClass1 {

    // jdk10内容
    @Test
    public void test1() {
        // jdk10之前的类型定义只能如此
        List<Integer> integerList1 = List.of(1, 2, 3);
        for (Integer integer : integerList1) {
            System.out.println(integer);
        }
        System.out.println("---");
        // jdk10之后可以用关键字var来进行类型推断
        var integerList2 = List.of(1, 2, 3);
        for (var integer : integerList2) {
            System.out.println(integer);
        }
    }

    // jdk11内容
    @Test
    public void test2() {
        String str1 = "   ";
        System.out.println(str1.isBlank());
        String str2 = " a b ";
        System.out.println(str2.isBlank());
        System.out.println(str2.strip());
        System.out.println(str2.stripLeading());
        System.out.println(str2.stripTrailing());
        String str3 = "abc";
        System.out.println(str3.repeat(3));
        String str4 = "abc\ndef\nghi";
        System.out.println(str4.lines().count());
    }
}
